
import React from 'react';
import { timeData } from 'js/core/timeData';
import echarts from 'js/lib/echarts';
import SelectTimeType from 'views/component/selectTimeType/selectTimeType';
import moment from 'moment';
import Flow from './flow';
import api from 'js/api/index';
import './singleStoreFlow.scss';
import SelectTitle from 'views/component/selectTitle/selectTitle';
import { SubViewLink } from 'views/component/subViewLink/subViewLink';
import { i18n } from 'js/core/i18n';


class Main extends React.Component {
  constructor() {
    super()
    this.state = {
      ShopIdList: null,
      Shop: null,
    }
  }
  componentDidMount() {
    this.ShopList();
  }
  ShopList = () => {
    api('/BaseSet/ShopList').then(data => {
      this.setState({ Shop: data.data[0] })
    });
  }
  shopNameOnChange = (shopInfo) => {
    this.setState({ Shop: shopInfo })
  }
  render() {
    let Shop = this.state.Shop
    return <div id="singleStoreFlow">
      <div className="deviceItem device-border flex-vcenter">
        <SelectTitle classStyle="name">{i18n.get('选择店铺')}</SelectTitle>
        <SubViewLink moduleName="shopSearch" className="flex-g-1 text-right deviceItemContent" title={i18n.get('选择店铺')} modelData={{ onChange: this.shopNameOnChange }}>
          {Shop ? Shop.ShopName : <div style={{ color: '#909090' }}>{i18n.get('选择店铺')}</div>}
        </SubViewLink>
      </div>
      {Shop && <Flow type={5} id={Shop.ShopId} />}
    </div>
  }
}


export default Main;